package service

import (
	//"fmt"
	"gowork/gatewayMemberGrpc/fjmServer/dao"
	"gowork/gatewayMemberGrpc/model"
	//"gowork/studentGrpc/webMessage"
	//"github.com/winterssy/sreq"
	//"context"
	//"google.golang.org/grpc"
)

type MemberSriImp struct{
	Dip *dao.MemberDaoImp
}

func (msi *MemberSriImp)InesrtSri(mb []*model.Member)map[string]string{
	var d = dao.MemberDaoImp{}
	msi.Dip = &d
	return msi.Dip.InesrtDao(mb)
}

func (msi *MemberSriImp)QuerySri() []*model.Member{
	var d = dao.MemberDaoImp{}
	msi.Dip = &d

	// returnData := make(map[string]interface{})
	// _ = sreq.Post("http://127.0.0.1:9302/grpc-gateway/student/insert",
		
	// 	sreq.WithForm(sreq.Values{
	// 		"id": "15",
	// 		"name": "Tiger Lake",
	// 		"birth": "2020-10-24",
	// 		"sex": "10++ nm cpu",
	// 	}),
	// ).JSON(&returnData)
	// if err != nil {
	// 	panic(err)
	// }
	
	//1、Dail连接
	// conn, err := grpc.Dial("localhost:5952", 
	// grpc.WithInsecure(),
	// // grpc.RoundRobin(grpclb.NewConsulResolver(
    // //     "127.0.0.1:8500", "grpc.health.v1.add",
    // // 	))
	// )

	// studentClient := webMessage.NewStudentServiceClient(conn)
	// var l = webMessage.List{}
	// res, err := studentClient.QueryStudent(context.TODO(), &l)
	// if err != nil {
	// 	fmt.Println(err)
	// 	return nil
	// }

	//fmt.Println(res, returnData)
	//fmt.Println(returnData)

	return msi.Dip.QueryDao()
}